package com.example.designpatterns.factory.simplefactory;

/**
 * 汽车工厂
 * 简单工厂模式只有一个工厂
 */
public class CarFactory {
    public static  Car createCar(String type){
        if("奥迪".equals(type)){
            return new Audi();
        }else if("比亚迪".equals(type)){
            return new Byd();
        }else{
            return null;
        }
    }

    public static  Car createAudi(){
        return new Audi();
    }

    public static  Car createByd(){
        return new Byd();
    }
}
